<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>

        // 参数中-传的只是一个标识
        // let s1 = Symbol('尚硅谷');
        // let s2 = Symbol('尚硅谷');

        // console.log(s1,s2);
        // console.log(s1 === s2);


        // 可以让俩个Symbol值相等
        // Symbol参数：可以影响具体的值
        let s1 = Symbol.for('sgg');
        let s2 = Symbol.for('sgg2');

        // console.log(s1 === s2);

       
        let obj = {
            name:"laowang",
            age:18,
            [s1]:"男",
            [s2]:["篮球","唱跳","rap"]
        }

        console.log(obj);

        // 遍历对象 可以用for in

        // for in 默认不循环 symbol属性
        // for(let item in obj){
        //     console.log(item);
        // }

        // 我就想让它给我遍历symbol属性
        let sAttr = Object.getOwnPropertySymbols(obj);

        console.log(sAttr);
        for(let item in sAttr){
            // console.log(item);

            let name = sAttr[item];
            // console.log(name);

            let val = obj[name];

            console.log(val);

            // console.log(sAttr[item]); //获取到每一个属性名，
            // console.log(obj[sAttr[item]]);
        }


    </script>
</body>
</html>